<?php
/**
 * Created by PhpStorm.
 * User: 76587
 * Date: 2018-05-29
 * Time: 11:38
 */

namespace services\user;

use services\user\models\Login;
use services\user\models\User;
use Yii;
use yii\base\UserException;
use yii\web\NotFoundHttpException;

class AuthLogic
{
    /**
     * Signup new user
     * @return string
     */
    public function Signup($post)
    {
        $user = new User();
        /**
         * @var User $user
         */
        if ($user->load($post, '')) {
            if ($user->save()) {
                return $user->toArray(['id','username','head']);
            }
        }
        return null;
    }
}